unit frmPrincipal;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Menus, DB, MDOCustomDataSet, MDOQuery, ImgList,
  ExtCtrls,  jpeg, ComCtrls, ActnList, frmUsuarios, xpman, frmcadModelo{, Enter2Tab};

type
  TF_Principal = class(TForm)
    Menu: TMainMenu;
    LogOff1: TMenuItem;
    Sair1: TMenuItem;
    Financeiro1: TMenuItem;
    Estoque1: TMenuItem;
    Arqivos1: TMenuItem;
    Cliente1: TMenuItem;
    Cidade1: TMenuItem;
    Estado1: TMenuItem;
    Categoria1: TMenuItem;
    SubCategoria1: TMenuItem;
    Mesa1: TMenuItem;
    Reserva1: TMenuItem;
    Produto1: TMenuItem;
    Medida1: TMenuItem;
    Configurao1: TMenuItem;
    Usurios1: TMenuItem;
    Pedido1: TMenuItem;
    Compra1: TMenuItem;
    Venda1: TMenuItem;
    Contas1: TMenuItem;
    APagar1: TMenuItem;
    AReceber1: TMenuItem;
    Agendamento1: TMenuItem;
    ReservarMesa1: TMenuItem;
    AcertoEstoque1: TMenuItem;
    Produtos1: TMenuItem;
    QryPermicao: TMDOQuery;
    Relatrios1: TMenuItem;
    Imagens: TImageList;
    Cardpio1: TMenuItem;
    Pizza1: TMenuItem;
    Lanche1: TMenuItem;
    Poro1: TMenuItem;
    Prato1: TMenuItem;
    Refeico1: TMenuItem;
    Bebida1: TMenuItem;
    Doce1: TMenuItem;
    Salgada1: TMenuItem;
    Suco1: TMenuItem;
    Vitamina1: TMenuItem;
    Dose1: TMenuItem;
    Refrigerante1: TMenuItem;
    Cerveja1: TMenuItem;
    PnCat: TPanel;
    PnFinan: TPanel;
    PnMapMesa: TPanel;
    PnSubCat: TPanel;
    Sobremesa1: TMenuItem;
    Extras1: TMenuItem;
    PnPord: TPanel;
    GbCat: TGroupBox;
    ImPor: TImage;
    ImBebida: TImage;
    ImExtra: TImage;
    ImPrato: TImage;
    ImLanche: TImage;
    ImPizza: TImage;
    ImSobre: TImage;
    ImRef: TImage;
    GbSub: TGroupBox;
    ImCerv: TImage;
    ImDose: TImage;
    Imrefri: TImage;
    ImSuco: TImage;
    ImVita: TImage;
    GroupBox1: TGroupBox;
    ImCaixa: TImage;
    ImCalc: TImage;
    ImConta: TImage;
    ImPagar: TImage;
    PnFuncoes: TPanel;
    GbFuncoes: TGroupBox;
    ImFinan: TImage;
    ImCardapio: TImage;
    ImMpMesas: TImage;
    ImCozinha: TImage;
    ImgStatus: TImage;
    ImRelat: TImage;
    GroupBox2: TGroupBox;
    ImgMes1: TImage;
    GroupBox3: TGroupBox;
    ImProd: TImage;
    PnPizza: TPanel;
    GroupBox4: TGroupBox;
    ImPzDoce: TImage;
    ImPzSal: TImage;
    Image1: TImage;
    Image2: TImage;
    Image3: TImage;
    Image4: TImage;
    Image5: TImage;
    Image6: TImage;
    Image7: TImage;
    ImFundo: TImage;
    StatusBar1: TStatusBar;
    Actions: TActionList;
    Action1: TAction;
    Pesquisas1: TMenuItem;
   // Tab2Enter: TTab2Enter;
    procedure LogOff1Click(Sender: TObject);
    procedure Sair1Click(Sender: TObject);
    procedure ImFinanClick(Sender: TObject);
    procedure ImCardapioClick(Sender: TObject);
    procedure ImMpMesasClick(Sender: TObject);
    procedure ImBebidaClick(Sender: TObject);
    procedure ImPizzaClick(Sender: TObject);
    procedure ImExtraClick(Sender: TObject);
    procedure ImLancheClick(Sender: TObject);
    procedure ImPorClick(Sender: TObject);
    procedure ImPratoClick(Sender: TObject);
    procedure ImRefClick(Sender: TObject);
    procedure ImSobreClick(Sender: TObject);
    procedure ImPzDoceClick(Sender: TObject);
    procedure ImPzSalClick(Sender: TObject);
    procedure ImSucoClick(Sender: TObject);
    procedure ImrefriClick(Sender: TObject);
    procedure ImDoseClick(Sender: TObject);
    procedure ImCervClick(Sender: TObject);
    procedure Image2Click(Sender: TObject);
    procedure Image7Click(Sender: TObject);
    procedure Image4Click(Sender: TObject);
    procedure Image5Click(Sender: TObject);
    procedure Image6Click(Sender: TObject);
    procedure Image3Click(Sender: TObject);
    procedure Image1Click(Sender: TObject);
    procedure Action1Execute(Sender: TObject);
    procedure Usurios1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure Categoria1Click(Sender: TObject);
    procedure Estado1Click(Sender: TObject);
    procedure Medida1Click(Sender: TObject);
    procedure SubCategoria1Click(Sender: TObject);
    procedure Produto1Click(Sender: TObject);


  private
    { Private declarations }
  public
    { Public declarations }

    _iUser : Integer;
    procedure Saida;
  end;

var
  F_Principal: TF_Principal;


implementation

uses frmLogin, frmDMGeral, frmCategoria, frmEstado, frmMedida,
  frmSubCategoria, frmProdutos;

{$R *.dfm}


procedure TF_Principal.LogOff1Click(Sender: TObject);
begin
  Saida;
end;

procedure TF_Principal.Sair1Click(Sender: TObject);
begin
  Close;
end;

procedure TF_Principal.ImFinanClick(Sender: TObject);
begin
  PnFinan.Visible := True;
  PnFinan.top := 208;
  PnFinan.left := 472;
  PnFuncoes.Visible := False;
end;

procedure TF_Principal.ImCardapioClick(Sender: TObject);
begin
  PnCat.Visible := True;
  PnCat.Top := 208;
  PnCat.Left := 472;
  PnFuncoes.Visible := False;
end;

procedure TF_Principal.ImMpMesasClick(Sender: TObject);
begin
  PnMapMesa.Visible := True;
  PnMapMesa.Top := 208;
  PnMapMesa.Left := 472;
  PnFuncoes.Visible := False;
end;

procedure TF_Principal.ImBebidaClick(Sender: TObject);
begin
  PnSubCat.Visible := True;
  PnSubCat.Top := 208;
  PnSubCat.Left := 472;
  PnCat.Visible := False;
end;

procedure TF_Principal.ImPizzaClick(Sender: TObject);
begin
  PnPizza.Visible := True;
  PnPizza.Top := 208;
  PnPizza.Left := 472;
  PnCat.Visible := False;
end;

procedure TF_Principal.ImExtraClick(Sender: TObject);
begin
  PnPord.Visible := True;
  PnPord.Top := 208;
  PnPord.Left := 472;
  PnCat.Visible := False;
end;

procedure TF_Principal.ImLancheClick(Sender: TObject);
begin
  PnPord.Visible := True;
  PnPord.Top := 208;
  PnPord.Left := 472;
  PnCat.Visible := False;
end;

procedure TF_Principal.ImPorClick(Sender: TObject);
begin
  PnPord.Visible := True;
  PnPord.Top := 208;
  PnPord.Left := 472;
  PnCat.Visible := False;
end;

procedure TF_Principal.ImPratoClick(Sender: TObject);
begin
  PnPord.Visible := True;
  PnPord.Top := 208;
  PnPord.Left := 472;
  PnCat.Visible := False;
end;

procedure TF_Principal.ImRefClick(Sender: TObject);
begin
  PnPord.Visible := True;
  PnPord.Top := 208;
  PnPord.Left := 472;
  PnCat.Visible := False;
end;

procedure TF_Principal.ImSobreClick(Sender: TObject);
begin
  PnPord.Visible := True;
  PnPord.Top := 208;
  PnPord.Left := 472;
  PnCat.Visible := False;
end;

procedure TF_Principal.ImPzDoceClick(Sender: TObject);
begin
  PnPord.Visible := True;
  PnPord.Top := 208;
  PnPord.Left := 472;
  PnPizza.Visible := False;
end;

procedure TF_Principal.ImPzSalClick(Sender: TObject);
begin
  PnPord.Visible := True;
  PnPord.Top := 208;
  PnPord.Left := 472;
  PnPizza.Visible := False;
end;

procedure TF_Principal.ImSucoClick(Sender: TObject);
begin
  PnPord.Visible := True;
  PnPord.Top := 208;
  PnPord.Left := 472;
  PnSubCat.Visible := False;
end;

procedure TF_Principal.ImrefriClick(Sender: TObject);
begin
  PnPord.Visible := True;
  PnPord.Top := 208;
  PnPord.Left := 472;
  PnSubCat.Visible := False;
end;

procedure TF_Principal.ImDoseClick(Sender: TObject);
begin
  PnPord.Visible := True;
  PnPord.Top := 208;
  PnPord.Left := 472;
  PnSubCat.Visible := False;
end;

procedure TF_Principal.ImCervClick(Sender: TObject);
begin
  PnPord.Visible := True;
  PnPord.Top := 208;
  PnPord.Left := 472;
  PnSubCat.Visible := False;
end;

procedure TF_Principal.Image2Click(Sender: TObject);
begin
  PnFuncoes.Visible := False;
end;

procedure TF_Principal.Image7Click(Sender: TObject);
begin
    PnSubCat.Visible := False;
    PnCat.Visible := True;
end;

procedure TF_Principal.Image4Click(Sender: TObject);
begin
    PnPord.Visible := False;
    PnCat.Visible := True;
end;

procedure TF_Principal.Image5Click(Sender: TObject);
begin
  PnPizza.Visible := False;
  PnCat.Visible := True;
end;

procedure TF_Principal.Image6Click(Sender: TObject);
begin
  PnFinan.Visible := False;
  PnFuncoes.Visible := True;
end;

procedure TF_Principal.Image3Click(Sender: TObject);
begin
  PnMapMesa.Visible := False;
  PnFuncoes.Visible := True;
end;

procedure TF_Principal.Image1Click(Sender: TObject);
begin
  PnCat.Visible := False;
  PnFuncoes.Visible := True;
end;

procedure TF_Principal.Action1Execute(Sender: TObject);
begin
  PnFuncoes.top := 208;
  PnFuncoes.left := 472;
  PnFuncoes.Visible := Visible;
end;





procedure TF_Principal.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
    Application.Terminate;
end;

procedure TF_Principal.FormCreate(Sender: TObject);
begin
  Saida;

end;

procedure TF_Principal.Saida;
begin
    _iUser := 0;
  if not Assigned(F_Login) then
    Application.CreateForm(TF_Login, F_Login);
  F_Login.ShowModal;
  if F_Login.ModalResult = mrOk then begin
    F_Login.Free;
    F_Login := nil;
  end else begin
    Application.Terminate;
  end;
end;


procedure TF_Principal.Medida1Click(Sender: TObject);
begin
  if not Assigned(F_Medida) then
    Application.CreateForm(TF_Medida,F_Medida);
  F_Medida.Inicio('UNIDADE');
end;

procedure TF_Principal.Usurios1Click(Sender: TObject);
begin

  if not Assigned(F_Usuarios) then
    Application.CreateForm(TF_Usuarios,F_Usuarios);
  F_Usuarios.Inicio;
end;

procedure TF_Principal.Categoria1Click(Sender: TObject);
begin
  if not Assigned(F_Categoria)then
    Application.CreateForm(TF_Categoria, F_categoria);
  F_Categoria.Inicio('GRUPO');
end;

procedure TF_Principal.Estado1Click(Sender: TObject);
begin
  if not Assigned(F_Estado)then
    Application.CreateForm(TF_Estado, F_Estado);
  F_Estado.Inicio('ESTADO');
end;


procedure TF_Principal.SubCategoria1Click(Sender: TObject);
begin
  if not Assigned(F_SubCategoria)then
    Application.CreateForm(TF_SubCategoria, F_SubCategoria);
  F_SubCategoria.Inicio('SUBGRUPO');

end;

procedure TF_Principal.Produto1Click(Sender: TObject);
begin
  if not Assigned(F_Produtos)then
    Application.CreateForm(TF_Produtos, F_Produtos);
  F_Produtos.Inicio('PRODUTO');
end;

end.
